package cn.edu.nchu.fragmentdemo.db.server;

import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.stmt.QueryBuilder;

import java.sql.SQLException;
import java.util.List;

import cn.edu.nchu.fragmentdemo.bean.Route;
import cn.edu.nchu.fragmentdemo.bean.WayPoint;

/**
 * @className: RouteServer
 * @description: TODO 类描述
 * @author: chenzilei
 * @date: 2023/10/18 20:00
 **/
public class WayPointServer {
    public static List<WayPoint> getWaypointList(Integer routeId, Dao<WayPoint, Integer> waypointDao){
        try {
            QueryBuilder<WayPoint, Integer> queryBuilder = waypointDao.queryBuilder();
            queryBuilder.where().eq("route_id", routeId);
            List<WayPoint> wayPointList=queryBuilder.query();
            if (wayPointList != null) {
                return wayPointList;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
